home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1998 July / Software of the Month Club 1998 July.iso / mac / Education / PredDemo / PredDemo1.0 / PredDemo1.3 final / 00001_MovScr-General.ls next >
Encoding:
Text File  |  1998-05-06  |  6.4 KB  |  244 lines

  1. on startMovie
  2.   global bckDrp, delayPassCount
  3.   set delayPassCount to 0
  4.   set the volume of sound 1 to 255
  5.   set the volume of sound 2 to 180
  6.   if (the stageTop = 0) and (the stageLeft = 0) then
  7.     nothing()
  8.   else
  9.     if objectp(bckDrp) then
  10.       bckDrp(mdispose)
  11.     end if
  12.     set bckDrp to Backdrop(mnew)
  13.     bckDrp(mRegister, "20128802-373")
  14.     bckDrp(mShow)
  15.   end if
  16. end
  17.  
  18. on stopMovie
  19.   global bckDrp
  20.   if objectp(bckDrp) then
  21.     bckDrp(mdispose)
  22.   end if
  23. end
  24.  
  25. on LegalButtonHandler
  26.   global quitHold
  27.   set upB to the castNum of sprite the clickOn
  28.   set fakeStillDown to 1
  29.   repeat while fakeStillDown = 1
  30.     set the castNum of sprite the clickOn to upB + rollOver(the clickOn)
  31.     updateStage()
  32.     wait(0.10000000000000001)
  33.     set fakeStillDown to the stillDown
  34.   end repeat
  35.   set the castNum of sprite the clickOn to upB
  36.   if rollOver(the clickOn) = 0 then
  37.     set quitHold to 0
  38.     abort()
  39.   end if
  40.   updateStage()
  41.   puppetSound("buttonSound1")
  42.   updateStage()
  43.   repeat while soundBusy(1)
  44.     nothing()
  45.   end repeat
  46.   puppetSound(0)
  47. end
  48.  
  49. on myDelay t
  50.   global delayPassCount
  51.   if delayPassCount = 0 then
  52.     startTimer()
  53.     set delayPassCount to 1
  54.   end if
  55.   if the timer < (t * 60) then
  56.     go(the frame)
  57.   else
  58.     set delayPassCount to 0
  59.   end if
  60. end
  61.  
  62. on wait t
  63.   startTimer()
  64.   repeat while the timer < (t * 60)
  65.     nothing()
  66.   end repeat
  67. end
  68.  
  69. on noPuppets
  70.   repeat with x = 1 to 35
  71.     set the visible of sprite x to 1
  72.     puppetSprite(x, 0)
  73.   end repeat
  74.   repeat with x = 40 to 48
  75.     set the visible of sprite x to 1
  76.     puppetSprite(x, 0)
  77.   end repeat
  78. end
  79.  
  80. on soundOff ch, t
  81.   global delayFactor
  82.   if soundBusy(ch) then
  83.     set currentSound to the volume of sound ch
  84.     repeat with i = currentSound down to 0
  85.       set the volume of sound ch to i
  86.       set delayFactor to 100
  87.       repeat with x = 1 to t * delayFactor
  88.         nothing()
  89.       end repeat
  90.     end repeat
  91.   end if
  92. end
  93.  
  94. on initQuestion
  95.   global wrongRespCount, locationPrefix
  96.   set wrongRespCount to 0
  97.   if locationPrefix = "ma" then
  98.     put "Match this animal ->" & RETURN & "with its picture." into field "maMsg"
  99.   end if
  100.   if locationPrefix = "QA" then
  101.     put "Click on the correct answer to this question." into field "QAmsg"
  102.   end if
  103. end
  104.  
  105. on initFoodChain
  106.   global rightRespCount, wrongRespCount, placedIconList
  107.   put "Drag an icon to its correct position on the food chain." into field "FCmsg"
  108.   set placedIconList to []
  109.   set rightRespCount to 0
  110.   set wrongRespCount to 0
  111.   noPuppets()
  112.   updateStage()
  113. end
  114.  
  115. on iconFlash
  116.   set upB to the castNum of sprite the clickOn
  117.   set dwnB to upB + 1
  118.   repeat with r = 1 to 3
  119.     set the castNum of sprite the clickOn to dwnB
  120.     updateStage()
  121.     wait(0.20000000000000001)
  122.     set the castNum of sprite the clickOn to upB
  123.     updateStage()
  124.     wait(0.20000000000000001)
  125.   end repeat
  126.   set the castNum of sprite the clickOn to dwnB
  127.   updateStage()
  128. end
  129.  
  130. on rightAnswer
  131.   global rightCount
  132.   set rightCount to rightCount + 1
  133.   put "Good Work!" into field "qaMsg"
  134.   iconFlash()
  135.   wait(2)
  136.   go(#next)
  137. end
  138.  
  139. on rightAnswerAlt
  140.   global rightCount
  141.   put "That's correct!" into field "maMsg"
  142.   updateStage()
  143.   set rightCount to rightCount + 1
  144.   go(the frame + 1)
  145. end
  146.  
  147. on wrongAnswer1
  148.   global wrongRespCount, wrongCount, locationPrefix
  149.   set msgWin to locationPrefix & "msg"
  150.   if wrongRespCount = 0 then
  151.     put "Please try again." into field msgWin
  152.     updateStage()
  153.     set wrongRespCount to wrongRespCount + 1
  154.   else
  155.     put "Sorry." & RETURN & "The correct answer is:" into field msgWin
  156.     updateStage()
  157.     set wrongRespCount to 0
  158.     set wrongCount to wrongCount + 1
  159.     go(the frame + 1)
  160.   end if
  161. end
  162.  
  163. on snapIcon
  164.   global origH, origV, rightSprite, rightAns, rightCount, wrongCount, rightRespCount, wrongRespCount, wrongRespLimit, placedIconList, delayFactor
  165.   if rightSprite = 0 then
  166.     repeat with ch = 11 to 10 + rightAns
  167.       if sprite the clickOn intersects ch then
  168.         if getOne(placedIconList, ch + 15) <> 0 then
  169.           set the locH of sprite the clickOn to origH
  170.           set the locV of sprite the clickOn to origV
  171.           updateStage()
  172.           exit
  173.         end if
  174.       end if
  175.     end repeat
  176.     repeat with ch = 11 to 10 + rightAns
  177.       if sprite the clickOn intersects ch then
  178.         if getOne(placedIconList, ch + 15) <> 0 then
  179.           exit repeat
  180.         end if
  181.         set wrongRespCount to wrongRespCount + 1
  182.         if wrongRespCount < wrongRespLimit then
  183.           put "Please try again." into field "FCmsg"
  184.           exit repeat
  185.           next repeat
  186.         end if
  187.         put "Sorry." & RETURN & "The correct answer is:" into field "FCmsg"
  188.         set wrongCount to wrongCount + 1
  189.         set wrongRespCount to 0
  190.         go(the frame + 1)
  191.         exit
  192.       end if
  193.     end repeat
  194.     set the locH of sprite the clickOn to origH
  195.     set the locV of sprite the clickOn to origV
  196.     updateStage()
  197.   else
  198.     if sprite the clickOn intersects rightSprite then
  199.       set rightRespCount to rightRespCount + 1
  200.       if rightRespCount = rightAns then
  201.         set respName to "rightAns" & random(3)
  202.         put "Good job!" into field "FCmsg"
  203.         set rightCount to rightCount + 1
  204.         set rightRespCount to 0
  205.         noPuppets()
  206.         go(#next)
  207.         exit
  208.       else
  209.         put "That's right!" & RETURN & "Keep going!" into field "FCmsg"
  210.       end if
  211.       set the moveableSprite of sprite the clickOn to 0
  212.       set the visible of sprite rightSprite to 0
  213.       set the castNum of sprite the clickOn to the castNum of sprite the clickOn + 1
  214.       puppetSprite(the clickOn, 1)
  215.       set the locH of sprite the clickOn to the locH of sprite rightSprite
  216.       set the locV of sprite the clickOn to the locV of sprite rightSprite
  217.       updateStage()
  218.       add(placedIconList, the clickOn)
  219.     else
  220.       repeat with ch = 11 to 10 + rightAns
  221.         if sprite the clickOn intersects ch then
  222.           if getOne(placedIconList, ch + 15) <> 0 then
  223.             exit repeat
  224.           end if
  225.           set wrongRespCount to wrongRespCount + 1
  226.           if wrongRespCount < wrongRespLimit then
  227.             put "Try again, please." into field "FCmsg"
  228.             exit repeat
  229.             next repeat
  230.           end if
  231.           put "Sorry, the correct answer is:" into field "FCmsg"
  232.           set wrongCount to wrongCount + 1
  233.           set wrongRespCount to 0
  234.           go(the frame + 1)
  235.           exit
  236.         end if
  237.       end repeat
  238.       set the locH of sprite the clickOn to origH
  239.       set the locV of sprite the clickOn to origV
  240.       updateStage()
  241.     end if
  242.   end if
  243. end
  244.